package com.autcar.training.service;

import com.autcar.training.dao.FeedBackMapper;
import com.autcar.training.entity.FeedBack;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ProjectName: training
 * @Package: com.autcar.training.service
 * @ClassName: FeedBackServiceImpl
 * @Author: YHHHH
 * @Description:
 * @Date: 2020/8/29 11:14
 * @Version: 1.0
 */
@Service
public class FeedBackServiceImpl implements  FeedBackService {

    @Resource
    private FeedBackMapper feedBackMapper;
    @Resource
    private OrderService orderService;


    //增加评论
    @Override
    public int addFeedBack(FeedBack feedBack) {

        return feedBackMapper.insert(feedBack);
    }
    //删除一条信息反馈
    @Override
    public int deleteFeedBackById(Integer id) {
        return feedBackMapper.deleteById(id);
    }
    //编辑信息反馈
    @Override
    public int updateFeedBack(FeedBack feedBack) {
        return feedBackMapper.updateById(feedBack);
    }
    //通过订单编号查看信息反馈
    @Override
    public FeedBack selectFeedBackById(Integer id) {
        return feedBackMapper.selectById(id);
    }
    //查看所有反馈
    @Override
    public List<FeedBack> findAllFeedBack() {
        return feedBackMapper.selectList(null);
    }

    @Override
    public FeedBack selectByOid(String oid) {
        return feedBackMapper.selectOne(new QueryWrapper<FeedBack>().select("oid",oid));
    }
}
